package com.bw.a2207a.http

import com.bw.a2207a.Const
import com.bw.a2207a.Const.Companion.URL_GOODS
import com.bw.a2207a.Const.Companion.URL_GOODS_ADDCAR
import com.bw.a2207a.Const.Companion.URL_GOODS_Comment
import com.bw.a2207a.Const.Companion.URL_GOODS_DELETECAR
import com.bw.a2207a.Const.Companion.URL_GOODS_DETAIL
import com.bw.a2207a.Const.Companion.URL_GOODS_category
import com.bw.a2207a.Const.Companion.URL_GOODS_selectCar
import com.bw.a2207a.Const.Companion.URL_LOGIN
import com.bw.a2207a.base.BaseBean
import com.bw.a2207a.bean.BannerBean
import com.bw.a2207a.bean.CartBean
import com.bw.a2207a.bean.CommentBean
import com.bw.a2207a.bean.GoodsBean
import com.bw.a2207a.bean.LoginBean
import com.bw.a2207a.bean.TypeBean
import retrofit2.http.Body
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query
import retrofit2.http.Url

/**
 *
 * @ClassName: ApiService
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/10/16 12:11 PM
 * @Version: 1.0
 */
interface ApiService {

    //suspend 挂起函数
    @POST(Const.URL_REGISTER)
    suspend fun register(@Body map: HashMap<String, String>): BaseBean<LoginBean>

    //suspend 挂起函数
    @POST(URL_LOGIN)
    suspend fun login(@Body map: HashMap<String, String>): BaseBean<LoginBean>

    @GET("/banner/json")
    suspend fun getBanner(): BaseBean<List<BannerBean>>


    @FormUrlEncoded
    @POST("/banner/json")
    suspend fun uploadData(
        @Url url: String,
        @FieldMap map: Map<String, @JvmSuppressWildcards Any>
    ): BaseBean<String>

    @GET(URL_GOODS)
    suspend fun getGoods(
        @Query("category_id") category_id: Int,
        @Query("currentPage") currentPage: Int,
        @Query("pageSize") pageSize: Int
    ): BaseBean<List<GoodsBean>>

    @GET(URL_GOODS_DETAIL)
    suspend fun getGoodsDetail(
        @Query("goods_id") category_id: Int
    ): BaseBean<GoodsBean>

    @POST(URL_GOODS_ADDCAR)
    suspend fun addCar(
        @Body map: HashMap<String, Int>
    ): BaseBean<String>

    @POST(URL_GOODS_DELETECAR)
    suspend fun deleteCar(
        @Body map: HashMap<String, Int>
    ): BaseBean<String>

    //查询购物车
    @GET(URL_GOODS_selectCar)
    suspend fun getCar(): BaseBean<List<CartBean>>


    //查询分类列表
    @GET(URL_GOODS_category)
    suspend fun getType(): BaseBean<List<TypeBean>>


    //查询评论列表
    @GET(URL_GOODS_Comment)
    suspend fun getComment(@Query("videoId") videoId: Int): BaseBean<List<CommentBean>>

}